package com.eee.xiang.market.service.impl;

import com.eee.xiang.market.beans.OperateResponse;
import com.eee.xiang.market.beans.TUser;
import com.eee.xiang.market.dao.mapper.TUserMapper;
import com.eee.xiang.market.service.IAdminService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminServiceImpl implements IAdminService {

    @Autowired
    private TUserMapper userMapper;

    @Override
    public OperateResponse changePWD(TUser user) {
        return OperateResponse.obtainSuccessResponse(userMapper.changePWD(user));
    }

    @Override
    public List<TUser> userList(TUser userForm, Pageable pageable) {
        PageHelper.startPage(pageable.getPageNumber(), pageable.getPageSize());
        List<TUser> tUsers = userMapper.selectUserListByPage(userForm);
        return tUsers;
    }
}
